<%@ page contentType="text/html; charset=utf-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>新增单证</title> 
        <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery/jquery-1.6.1.min.js"></script>
        <script type="text/javascript"   src="${pageContext.request.contextPath}/js/DatePicker/WdatePicker.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/js/cont_diqu.js"></script>
        <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/css.css" />
        <script language="javascript" type="text/javascript" src="${pageContext.request.contextPath}/document/j.js" ></script>
        <link href="${pageContext.request.contextPath}/css/cont.css" rel="stylesheet" type="text/css"/>
      
        <script type="text/javascript">
       
            var fileInputNumber = 0;
            var fileName = "";
            function addFile()　　  	{	


                var strFile = "file"+fileInputNumber;
                var filePath = document.getElementById(strFile);


                document.getElementById(strFile).style.display = "none";
                var paths = filePath.value.split("\\");
                var name = paths[paths.length-1];
		
                fileName=fileName+"%"+name;
			
                document.getElementById("fileName").value=fileName;
	
                var str1 =
                    '<div style="background-color:#E7EBF7">'+
                    '<font size="2" style="width:300px">'+name+'</font>'+
                    '<a href="#"><img onclick="removeFile(this,'+strFile+')" src="../images/del2.gif" border="0" alt="删除附件"/></a>'+
                    '</div>';
                var _file = document.getElementById("_file");
			
                _file.insertAdjacentHTML("beforeend",str1);
                addInput();
            }
	
            function addInput(){
                fileInputNumber++;
                var strFile = "file"+fileInputNumber;
                var str2 = '<input name="file" id="'+strFile+'" type="file" value="添加附件" onchange="addFile()" />';
                var _input = document.getElementById("input");
                _input.insertAdjacentHTML("afterbegin",str2);
	
            }
        	
            function removeFile(id,strFile) {
                var new_tr = id.parentNode.parentNode;
                try {
                    //new_tr.removeNode(true);
                    // just ie , not w3c;
                    // other idea
                    var tmp = new_tr.parentNode;
                    // 为了在ie和firefox下都能正常使用,就要用另一个方法代替,最取上一层的父结点,然后remove.
                    tmp.removeChild(new_tr);		
                    removeInput(strFile);
                } catch(e) {}
            }
            function removeInput(strFile) {
                var _input = document.getElementById("input");
                try {
                    //new_tr.removeNode(true);
                    // just ie , not w3c;
                    // other idea
                    // 为了在ie和firefox下都能正常使用,就要用另一个方法代替,最取上一层的父结点,然后remove.
                    input.removeChild(strFile);
                } catch(e) {}
            }
            function sub(){
                return true;
            }
             var timer;
        </script>
           <style>
            body,td,th{font-size:12px}
            .alllisttitle{ padding-left:10px}
            a:link,a:visited{ color:#000000; text-decoration:none}
            a:hover{ color:#ff0000; text-decoration:none}
            select{ background:#ffffff!important}
        </style>
        <script type="text/javascript" src="${pageContext.request.contextPath}/js/kindeditor/kindeditor3.5.6.js" charset="UTF-8"></script>
        <script type="text/javascript">
            KE.show({
                id : "ca.fillSummy",
                width : "800px",
                height : "1000px",		    
                resizeMode : 1,
                allowFileManager : true,
                /*图片上传的SERVLET路径*/
                imageUploadJson: "${pageContext.request.contextPath}/keplugin/KEUploadImg.servlet",
                fileManagerJson : "${pageContext.request.contextPath}/keplugin/KEManageImages.servlet",
                //缺省为 *.*表示所有类型文件
                //accessoryTypes: "doc|docx",
                accessoryUploadJson: "${pageContext.request.contextPath}/keplugin/KEUploadAttach.servlet"   
            });
        </script>   
            
            
                <!--国家js开始-->
        <script type="text/javascript">
            var menuids=["suckertree"]

            function buildsubmenus(){
                for (var i=0; i<menuids.length; i++){
                    var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
                    for (var t=0; t<ultags.length; t++){
                        ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle"
                        ultags[t].parentNode.onmouseover=function(){
                            this.getElementsByTagName("ul")[0].style.display="block"
                        }
                        ultags[t].parentNode.onmouseout=function(){
                            this.getElementsByTagName("ul")[0].style.display="none"
                        }
                    }
                }
            }

            if (window.addEventListener)
                window.addEventListener("load", buildsubmenus, false)
            else if (window.attachEvent)
                window.attachEvent("onload", buildsubmenus)
        </script>
        <script type="text/javascript">
            function nav(id){
               
                if(document.getElementById(id).innerHTML=="所有(清空条件)"){
                    document.getElementById('text').innerHTML="";
                   document.getElementById('ca.country').value=-1;
                    document.getElementById('ca.countryName').value="";
                    $(".suckertree_ul").css("display","none");
                }
                else{
                    document.getElementById('text').innerHTML= document.getElementById(id).innerHTML;
                    document.getElementById('ca.country').value=id.substring(1);
               
                    document.getElementById('ca.countryName').value=document.getElementById(id).innerHTML;
                    $(".suckertree_ul").css("display","none");
                }
            };
        </script>
        <!--国家js结束-->
        
          <script type="text/javascript">
            
            function nav5(id){
                document.getElementById('text5').innerHTML= document.getElementById(id).innerHTML
                document.getElementById('ca.productName').value= document.getElementById(id).innerHTML;
                document.getElementById('ca.product').value=id;
                $("#cplb_big").css("display","none");
            };
            
            
            $(document).ready(function(){
                $("#cplb_tab1").mouseover(function(){
                    $("#cplb_tab1").css("background","#D3E0F3");
                    $("#cplb_tab1").css("border-right","0");
                    $("#cplb_tab1").css("border-left","2px solid #F3BE18");
                    $("#cplb_tab1").css("border-top","2px solid #F3BE18");
                    $("#cplb_tab1").css("border-bottom","2px solid #F3BE18");
                    $("#cplb_nav1").css("display","block");
                    $("#cplb_nav2").css("display","none");
                    $("#cplb_nav3").css("display","none");
                    $("#cplb_tab2").css("background","#EAF1F7");
                    $("#cplb_tab2").css("border-top","0");
                    $("#cplb_tab2").css("border-right","2px solid #F3BE18");
                    $("#cplb_tab2").css("border-bottom","1px dotted #96A6BD");
                    $("#cplb_tab3").css("background","#EAF1F7");
                    $("#cplb_tab3").css("border-right","2px solid #F3BE18");
                    $("#cplb_tab3").css("border-bottom","1px dotted #96A6BD");
                    $("#cplb_tab3").css("border-top","0");
                });

                $("#cplb_tab2").mouseover(function(){
                    $("#cplb_tab2").css("background","#D3E0F3");
                    $("#cplb_tab2").css("border-right","0");
                    $("#cplb_tab2").css("border-left","2px solid #F3BE18");
                    $("#cplb_tab2").css("border-top","2px solid #F3BE18");
                    $("#cplb_tab2").css("border-bottom","2px solid #F3BE18");
                    $("#cplb_nav2").css("display","block");
                    $("#cplb_nav1").css("display","none");
                    $("#cplb_nav3").css("display","none");
                    $("#cplb_tab1").css("background","#EAF1F7");
                    $("#cplb_tab1").css("border-top","0");
                    $("#cplb_tab1").css("border-right","2px solid #F3BE18");
                    $("#cplb_tab1").css("border-bottom","1px dotted #96A6BD");
                    $("#cplb_tab3").css("background","#EAF1F7");
                    $("#cplb_tab3").css("border-right","2px solid #F3BE18");
                    $("#cplb_tab3").css("border-bottom","1px dotted #96A6BD");
                    $("#cplb_tab3").css("border-top","0");
                });

                $("#cplb_tab3").mouseover(function(){
                    $("#cplb_tab3").css("background","#D3E0F3");
                    $("#cplb_tab3").css("border-right","0");
                    $("#cplb_tab3").css("border-left","2px solid #F3BE18");
                    $("#cplb_tab3").css("border-top","2px solid #F3BE18");
                    $("#cplb_tab3").css("border-bottom","2px solid #F3BE18");
                    $("#cplb_nav3").css("display","block");
                    $("#cplb_nav1").css("display","none");
                    $("#cplb_nav2").css("display","none");
                    $("#cplb_tab2").css("background","#EAF1F7");
                    $("#cplb_tab2").css("border-top","0");
                    $("#cplb_tab2").css("border-right","2px solid #F3BE18");
                    $("#cplb_tab2").css("border-bottom","1px dotted #96A6BD");
                    $("#cplb_tab1").css("background","#EAF1F7");
                    $("#cplb_tab1").css("border-right","2px solid #F3BE18");
                    $("#cplb_tab1").css("border-bottom","1px dotted #96A6BD");
                    $("#cplb_tab1").css("border-top","0");
                });

                $("#cplb_eav").mouseover(function(){
                    $("#cplb_big").css("display","block");
                });
                $("#cplb_eav").mouseout(function(){
                    $("#cplb_big").css("display","none");
                });
                $("#cplb_big").mouseover(function(){
                    $("#cplb_big").css("display","block");
                });
                $("#cplb_big").mouseout(function(){
                    $("#cplb_big").css("display","none");
                });
            });
        </script>
        
        
        
    </head>

    <body>
       <s:form id="form" name="form" action="%{actionURI}" method="post" theme="simple" ENCTYPE="multipart/form-data">
      
            <s:hidden id="fileName" name="fileName"></s:hidden>
          
            <s:hidden id="ca.countryName" name="ca.countryName" />
         <s:hidden id="ca.country" name="ca.country" />
            <s:hidden id="ca.productName" name="ca.productName" />
            <s:hidden id="ca.product" name="ca.product" />
             <s:if test="actionURI=='save'">
                <table width="80%" height="" border="0" cellspacing="1" cellpadding="2" align="center" bgcolor="#b5d6e6">               
                     
                    <tr height="28">
                        <td width="12%" align="right" bgcolor="#deebf1">
                            <b>案例编码:</b>					</td>
                        <td width="37%" bgcolor="#FFFFFF">
                            <s:textfield id="ca.code" name="ca.code" cssStyle="width: 60%"/>	

                        </td>
                    </tr>              
                    <tr height="28">
                        <td width="12%" align="right" bgcolor="#deebf1">
                            <b>案例名称:</b>					</td>
                        <td width="37%" bgcolor="#FFFFFF">
                            <s:textfield id="ca.name" name="ca.name" cssStyle="width: 60%"/>	

                        </td>
                    </tr>          
                    
                   
                    <tr>
                        <td width="12%" align="right" bgcolor="#deebf1">
                            <b>采购国:</b>
                        </td>
                        <td width="37%" bgcolor="#FFFFFF">
                          <!--国家开始-->
                            <div class="suckerdiv">
                                <ul id="suckertree">
                                    <li class="suckerdiv_li"><a href="#" id="text" style=" padding-left:5px;border:1px solid #cccccc; "><s:property value="ca.countryName"/></a>
                                        <ul class="suckertree_ul" style=";z-index:0; left:85px; top:0">
                                            <li class="suckertree_ul_li" style="z-index:9999;width:398px;"><a href="#" style="z-index:9999;width:398px;" id="font9999" onClick="nav('font9999')">所有(清空条件)</a>
                                                <s:iterator value="clist" var="c" status="u">
                                                    <li class="suckertree_ul_li" style="z-index:-${u.index}"><a href="#" style="z-index:-${u.index}" id="c${c.id}" onClick="nav('c${c.id}')">${c.name}</a>
                                                        <s:if test="#c.list!=null">
                                                            <ul>
                                                                <s:iterator value="#c.list" var="c2" status="uu">
                                                                    <li><a href="#" id="c${c2.id}" onClick="nav('c${c2.id}')">${c2.name}</a></li>
                                                                </s:iterator>


                                                            </ul> 
                                                        </s:if>
                                                    </li>
                                                </s:iterator>

                                        </ul>
                                    </li>
                                </ul>
                            </div>
                            <!--国家结束-->
                       </td>
                    <tr>
                        <td width="12%" align="right" bgcolor="#deebf1"><b>产品:</b></td>
                        <td width="37%" bgcolor="#FFFFFF">
						<div style="float:left; position:relative">
                             <div style="float:left; width:85px; height:24px; border:1px solid #cccccc; background:#ffffff" id="cplb_eav"><span style=" float:left;width:75px; height:24px; background:url(../images/jiansuo_bg.jpg) no-repeat right; padding:0 7px 0 3px;cursor:hand;" id="text5">${document.productName}</span></div>
                            <table width="700" style="border:1px solid #ADCAF2;display:none; position:absolute; background:#ffffff;top:26px;left:0px;" cellpadding="0" cellspacing="0" id="cplb_big">
                                <tr>
                                    <td valign="top" style="border-right:1px solid #F2BC14; width:35px;"><table border="0" cellpadding="0" cellspacing="0" style="width:35px; margin-right:-6px">
                                            <s:iterator value="proList" var="p" status="u">
                                                <tr>
                                                    <td height="80px" class="cplb_tab_link" id="cplb_tab${u.index+1}">${p.name}</td>
                                                </tr>
                                            </s:iterator>

                                        </table>
                                    </td>
                                    <td width="965" valign="top" class="cplb_td"><!--工业品-->
                                        <s:iterator value="proList" var="p" status="u">

                                            <s:if test="#u.first" >
                                                <table width="100%" border="0" cellspacing="15" cellpadding="0" class="cplb_table" id="cplb_nav${u.index+1}">
                                                </s:if>
                                                <s:else>
                                                    <table width="100%" border="0" cellspacing="15" cellpadding="0" class="cplb_table" id="cplb_nav${u.index+1}" style="display:none">
                                                    </s:else>
                                                    <s:iterator value="#p.produceObjlist" var="p1" status="p3">
                                                        <tr> 
                                                            <td width="33%">
                                                                <table width="100%" border="0" cellspacing="0" cellpadding="0" style=" background:url(images/cplb_bg.jpg) repeat-x top">
                                                                    <tr>
                                                                        <td style="padding:0 5px 0 5px;"><strong><a href="#" id="${p1.id}" onClick="nav5('${p1.id}')">${p1.name}</a></strong></td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td style="padding:0 5px 0 5px;">
                                                                            <s:iterator value="#p1.produceObjlist" var="p2" status="p2sta">
                                                                                <a href="#" id="${p2.id}" onClick="nav5('${p2.id}')">${p2.name}</a><s:if test="#p2sta.last"> </s:if>
                                                                                <s:else>|</s:else> 
                                                                            </s:iterator>
                                                                        </td>  
                                                                    </tr>
                                                                </table>
                                                            </td>
                                                        </tr>  </s:iterator>
                                                    </table>

                                            </s:iterator>

                                    </td>
                                </tr>
                            </table>
							</div>
                        </td>
                    </tr>                 
                    <tr>
                        <td width="12%" align="right" bgcolor="#deebf1"><b>业务时间:</b></td>
                       	<td width="37%" bgcolor="#FFFFFF">
                            <s:textfield id="ca.time" name="ca.time"
                                         onclick="WdatePicker()" cssClass="Wdate"
                                         onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" style="width:30%"></s:textfield></td>
                         
                     
                    </tr>
                    
                    <tr>
                       <td width="12%" align="right" bgcolor="#deebf1" style="vertical-align:top"><b>案例要点和解析:</b></td>
                        <td width="37%" bgcolor="#FFFFFF">	
                            <textarea id="ca.fillSummy" name="ca.fillSummy" rows="6" style="width: 100%"></textarea>
                        </td>
                    </tr>
                </table>
                </s:if>
                <s:else>
                 <s:hidden id="ca.id" name="ca.id"></s:hidden>
                    <table width="80%" height="" border="0" cellspacing="1" cellpadding="2" align="center" bgcolor="#b5d6e6">
                
                     
                    <tr height="28">
                        <td width="12%" align="right" bgcolor="#deebf1">
                            <b>案例编码:</b>					</td>
                        <td width="37%" bgcolor="#FFFFFF">
                           <s:property value="ca.code"/>
                        </td>
                    </tr>              
                    <tr height="28">
                        <td width="12%" align="right" bgcolor="#deebf1">
                            <b>案例名称:</b>					</td>
                        <td width="37%" bgcolor="#FFFFFF">
                            <input type="text" id="ca.name" name="ca.name" value="<s:property value="ca.name"/>"/>
                        </td>
                    </tr>          
                    
                   
                    <tr>
                        <td width="12%" align="right" bgcolor="#deebf1">
                            <b>采购国:</b>
                        </td>
                        <td width="37%" bgcolor="#FFFFFF">
                        	   <!--国家开始-->
                            <div class="suckerdiv">
                                <ul id="suckertree">
                                    <li class="suckerdiv_li"><a href="#" id="text" style=" padding-left:5px; border:1px solid #cccccc"><s:property value="ca.countryName"/></a>
                                        <ul class="suckertree_ul" style="z-index:10000">
                                            <li class="suckertree_ul_li" style="z-index:9999;width:398px;"><a href="#" style="z-index:9999;width:398px;" id="font9999" onClick="nav('font9999')">所有(清空条件)</a>
                                                <s:iterator value="clist" var="c" status="u">
                                                    <li class="suckertree_ul_li" style="z-index:-${u.index}"><a href="#" style="z-index:-${u.index}" id="c${c.id}" onClick="nav('c${c.id}')">${c.name}</a>
                                                        <s:if test="#c.list!=null">
                                                            <ul>
                                                                <s:iterator value="#c.list" var="c2" status="uu">
                                                                    <li><a href="#" id="c${c2.id}" onClick="nav('c${c2.id}')">${c2.name}</a></li>
                                                                </s:iterator>


                                                            </ul> 
                                                        </s:if>
                                                    </li>
                                                </s:iterator>

                                        </ul>
                                    </li>
                                </ul>
                            </div>
                            <!--国家结束-->
                       </td>
                    <tr>
                        <td width="12%" align="right" bgcolor="#deebf1"><b>产品:</b></td>
                        <td width="37%" bgcolor="#FFFFFF" style=" position:relative">
                            <div style="float:left; width:80px; height:24px; border:1px solid #cccccc; background:#ffffff" id="cplb_eav"><span style=" float:left;width:70px; height:24px; background:url(../images/jiansuo_bg.jpg) no-repeat right; padding:0 7px 0 3px;cursor:hand;" id="text5">${ca.productName}</span></div>
                            <table width="700" style="border:1px solid #ADCAF2;display:none; position:absolute; background:#ffffff;top:26px;left:0px;" cellpadding="0" cellspacing="0" id="cplb_big">
                                <tr>
                                    <td valign="top" style="border-right:1px solid #F2BC14; width:35px;"><table border="0" cellpadding="0" cellspacing="0" style="width:35px; margin-right:-6px">
                                            <s:iterator value="proList" var="p" status="u">
                                                <tr>
                                                    <td height="80px" class="cplb_tab_link" id="cplb_tab${u.index+1}">${p.name}</td>
                                                </tr>
                                            </s:iterator>

                                        </table>
                                    </td>
                                    <td width="965" valign="top" class="cplb_td"><!--工业品-->
                                        <s:iterator value="proList" var="p" status="u">

                                            <s:if test="#u.first" >
                                                <table width="100%" border="0" cellspacing="15" cellpadding="0" class="cplb_table" id="cplb_nav${u.index+1}">
                                                </s:if>
                                                <s:else>
                                                    <table width="100%" border="0" cellspacing="15" cellpadding="0" class="cplb_table" id="cplb_nav${u.index+1}" style="display:none">
                                                    </s:else>
                                                    <s:iterator value="#p.produceObjlist" var="p1" status="p3">
                                                        <tr> 
                                                            <td width="33%">
                                                                <table width="100%" border="0" cellspacing="0" cellpadding="0" style=" background:url(images/cplb_bg.jpg) repeat-x top">
                                                                    <tr>
                                                                        <td style="padding:0 5px 0 5px;"><strong><a href="#" id="${p1.id}" onClick="nav5('${p1.id}')">${p1.name}</a></strong></td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td style="padding:0 5px 0 5px;">
                                                                            <s:iterator value="#p1.produceObjlist" var="p2" status="p2sta">
                                                                                <a href="#" id="${p2.id}" onClick="nav5('${p2.id}')">${p2.name}</a><s:if test="#p2sta.last"> </s:if>
                                                                                <s:else>|</s:else> 
                                                                            </s:iterator>
                                                                        </td>  
                                                                    </tr>
                                                                </table>
                                                            </td>
                                                        </tr>  </s:iterator>
                                                    </table>

                                            </s:iterator>

                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>                 
                    <tr>
                        <td width="12%" align="right" bgcolor="#deebf1"><b>业务时间:</b></td>
                       	<td width="37%" bgcolor="#FFFFFF">
                            <input id="ca.time" name="ca.time" value="<s:date name="ca.time" format="yyyy-MM-dd"/>"
                                         onclick="WdatePicker()" cssClass="Wdate"
                                         onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" style="width:30%"></input></td>    
                    </tr>
                    
                    <tr>
                       <td width="12%" align="right" bgcolor="#deebf1"><b>案例要点和解析:</b></td>
                        <td width="37%" bgcolor="#FFFFFF">	
                            <textarea id="ca.fillSummy" name="ca.fillSummy" rows="6" style="width: 98%">
                                <s:property value="ca.fillSummy"/></textarea></td>
                    </tr>   
                   </table>
          
                 </s:else>
                <table width="100%" border="0" cellspacing="0" cellpadding="0"
                       height="8%">
                    <tr align="center" bgcolor="white">
					<td style="width:500px"></td>
                        <td align="center" height="12" style="padding-top: 5px">
                             <input class="mmBtn"  type="submit" value="保存" style="width:80px; text-align:center"/>
                            &nbsp;
                            <input name="button" type="button" class="mmBtn"
                                   onClick="window.location='list.action'" value="返回 " style="width:80px; text-align:center"/>
                        </td>
                    </tr>
                </table>
        </s:form>
    </body>
</html>